package com.file.system.entity.system;


import com.file.system.entity.basic.WebBasic;
import com.file.system.plugin.dict.Dict;
import com.file.system.plugin.validated.SQLInjectionValidation;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.*;
import javax.validation.groups.Default;
import java.io.Serializable;


/**
 * 菜单
 *
 * @author jch
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class WebMenu extends WebBasic implements Serializable {

    private static final long serialVersionUID = 1L;


    //新增
    public interface add extends Default {
    }

    //修改
    public interface update extends Default {
    }

    /**
     * 主键
     */
    @NotNull(groups = {update.class}, message = "主键不能为空")
    @Min(value = 1, message = "id长度最小1")
    private Long id;
    /**
     * 父级菜单id
     */
    @NotNull(groups = {add.class, update.class}, message = "父级菜单id不能为空")
    @Min(value = 1, message = "父级菜单id最小1")
    private Long pid;
    /**
     * 名称
     */
    @NotEmpty(groups = {update.class, add.class}, message = "名称不能为空")
    @Size(min = 1, max = 100, message = "名称长度1-100")
    @SQLInjectionValidation(fieldName = "名称")
    private String name;
    /**
     * 排序
     */
    @NotNull(groups = {add.class, update.class}, message = "排序不能为空")
    @Min(value = 1, message = "排序最小1")
    @Max(value = 2000, message = "排序最大2000")
    private Integer sort;
    /**
     * 请求地址
     */
    @Size(min = 1, max = 200, message = "请求地址长度1-200")
    @SQLInjectionValidation(fieldName = "请求地址", enableValidation = false)
    private String path;
    /**
     * 权限标识
     */
    @NotEmpty(groups = {update.class, add.class}, message = "权限标识不能为空")
    @Size(min = 1, max = 200, message = "权限标识长度1-200")
    @SQLInjectionValidation(fieldName = "权限标识", enableValidation = false)
    private String auth;
    /**
     * 图标
     */
    @Size(min = 1, max = 100, message = "图标长度1-100")
    @SQLInjectionValidation(fieldName = "图标", enableValidation = false)
    private String icon;
    /**
     * 组件路径
     */
    @Size(min = 1, max = 100, message = "组件路径长度1-100")
    @SQLInjectionValidation(fieldName = "组件路径", enableValidation = false)
    private String filePath;
    /**
     * 路由参数
     */
    @Size(min = 1, max = 100, message = "路由参数长度1-100")
    @SQLInjectionValidation(fieldName = "路由参数")
    private String params;
    /**
     * 是否显示（字典）
     */
    @Size(min = 1, max = 20, message = "是否显示长度1-20")
    @Dict("menuShow")
    @SQLInjectionValidation(fieldName = "是否显示")
    private String dictMenuShow;
    /**
     * 是否外链（字典）
     */
    @Size(min = 1, max = 20, message = "是否外链长度1-20")
    @Dict("menuIsLink")
    @SQLInjectionValidation(fieldName = "是否外链")
    private String dictMenuIsLink;
    /**
     * 菜单类型（字典）
     */
    @Size(min = 1, max = 20, message = "菜单类型长度1-20")
    @Dict("menuType")
    @SQLInjectionValidation(fieldName = "菜单类型")
    private String dictMenuType;
    /**
     * 菜单状态（字典）
     */
    @Size(min = 1, max = 20, message = "菜单状态长度1-20")
    @Dict("menuStatus")
    @SQLInjectionValidation(fieldName = "菜单状态")
    private String dictMenuStatus;
}
